<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get the requested schema information</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ref.pdo-cubrid.connection.html">« PDO_CUBRID DSN</a></li>
      <li style="float: right;"><a href="ref.pdo-dblib.html">MS SQL Server (PDO) »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.pdo-cubrid.html">CUBRID (PDO)</a></li>
    <li>Get the requested schema information</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="pdo.cubrid-schema" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">PDO::cubrid_schema</h1>
  <p class="verinfo">(PECL PDO_CUBRID &gt;= 8.3.0.0001)</p><p class="refpurpose"><span class="refname">PDO::cubrid_schema</span> &mdash; <span class="dc-title">Get the requested schema information</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-pdo.cubrid-schema-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>PDO::cubrid_schema</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$schema_type</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$table_name</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$col_name</code><span class="initializer"> = ?</span></span>): <span class="type">array</span></div>

  <p class="para rdfs-comment">
   This function is used to get the requested schema information from
   database. You have to designate <code class="parameter">table_name</code>, if you
   want to get information on certain table, <code class="parameter">col_name</code>,
   if you want to get information on certain column (can be used only with
   PDO::CUBRID_SCH_COL_PRIVILEGE).
  </p>

  <p class="para">
  The result of this function is returned as a two-dimensional array (column
  (associative array) * row (numeric array)). The following tables shows types
  of schema and the column structure of the result array to be returned based
  on the schema type.
  </p>

  <p class="para">
  <table class="doctable table">
   <caption><strong>Result Composition of Each Type</strong></caption>
    
     <thead>
      <tr>
       <th>Schema</th>
       <th>Column Number</th>
       <th>Column Name</th>
       <th>Value</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PDO::CUBRID_SCH_TABLE</td>
       <td>1</td>
       <td>NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>TYPE</td>
       <td>0:system table 1:view 2:table</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_VIEW</td>
       <td>1</td>
       <td>NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>TYPE</td>
       <td>1:view</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_QUERY_SPEC</td>
       <td>1</td>
       <td>QUERY_SPEC</td>
       <td class="empty">&nbsp;</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_ATTRIBUTE / PDO::CUBRID_SCH_TABLE_ATTRIBUTE</td>
       <td>1</td>
       <td>ATTR_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>DOMAIN</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>3</td>
       <td>SCALE</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>4</td>
       <td>PRECISION</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>5</td>
       <td>INDEXED</td>
       <td>1:indexed</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>6</td>
       <td>NOT NULL</td>
       <td>1:not null</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>7</td>
       <td>SHARED</td>
       <td>1:shared</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>8</td>
       <td>UNIQUE</td>
       <td>1:unique</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>9</td>
       <td>DEFAULT</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>10</td>
       <td>ATTR_ORDER</td>
       <td>base:1</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>11</td>
       <td>CLASS_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>12</td>
       <td>SOURCE_CLASS</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>13</td>
       <td>IS_KEY</td>
       <td>1:key</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_METHOD / PDO::CUBRID_SCH_TABLE_METHOD</td>
       <td>1</td>
       <td>NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>RET_DOMAIN</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>3</td>
       <td>ARG_DOMAIN</td>
       <td class="empty">&nbsp;</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_METHOD_FILE</td>
       <td>1</td>
       <td>METHOD_FILE</td>
       <td class="empty">&nbsp;</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_SUPER_TABLE / PDO::CUBRID_SCH_DIRECT_SUPER_TABLE / PDO::CUBRID_SCH_SUB_TABLE</td>
       <td>1</td>
       <td>CLASS_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>TYPE</td>
       <td>0:system table 1:view 2:table</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_CONSTRAINT</td>
       <td>1</td>
       <td>TYPE</td>
       <td>0:unique 1:index 2:reverse unique 3:reverse index</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>3</td>
       <td>ATTR_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>4</td>
       <td>NUM_PAGES</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>5</td>
       <td>NUM_KEYS</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>6</td>
       <td>PRIMARY_KEY</td>
       <td>1:primary key</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>7</td>
       <td>KEY_ORDER</td>
       <td>base:1</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_TRIGGER</td>
       <td>1</td>
       <td>NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>STATUS</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>3</td>
       <td>EVENT</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>4</td>
       <td>TARGET_CLASS</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>5</td>
       <td>TARGET_ATTR</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>6</td>
       <td>ACTION_TIME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>7</td>
       <td>ACTION</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>8</td>
       <td>PRIORITY</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>9</td>
       <td>CONDITION_TIME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>10</td>
       <td>CONDITION</td>
       <td class="empty">&nbsp;</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_TABLE_PRIVILEGE / PDO::CUBRID_SCH_COL_PRIVILEGE</td>
       <td>1</td>
       <td>CLASS_NAME / ATTR_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>PRIVILEGE</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>3</td>
       <td>GRANTABLE</td>
       <td class="empty">&nbsp;</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_PRIMARY_KEY</td>
       <td>1</td>
       <td>CLASS_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>ATTR_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>3</td>
       <td>KEY_SEQ</td>
       <td>base:1</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>4</td>
       <td>KEY_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>


      <tr>
       <td>PDO::CUBRID_SCH_IMPORTED_KEYS / PDO::CUBRID_SCH_EXPORTED_KEYS / PDO::CUBRID_SCH_CROSS_REFERENCE</td>
       <td>1</td>
       <td>PKTABLE_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>2</td>
       <td>PKCOLUMN_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>3</td>
       <td>FKTABLE_NAME</td>
       <td>base:1</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>4</td>
       <td>FKCOLUMN_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>5</td>
       <td>KEY_SEQ</td>
       <td>base:1</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>6</td>
       <td>UPDATE_ACTION</td>
       <td>0:cascade 1:restrict 2:no action 3:set null</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>7</td>
       <td>DELETE_ACTION</td>
       <td>0:cascade 1:restrict 2:no action 3:set null</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>8</td>
       <td>FK_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td class="empty">&nbsp;</td>
       <td>9</td>
       <td>PK_NAME</td>
       <td class="empty">&nbsp;</td>
      </tr>

     </tbody>
    
   </table>

  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-pdo.cubrid-schema-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">schema_type</code></dt>

     <dd>

      <p class="para">
       Schema type that you want to know.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">table_name</code></dt>

     <dd>

      <p class="para">
       Table you want to know the schema of.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">col_name</code></dt>

     <dd>

      <p class="para">
       Column you want to know the schema of.
     </p>
    </dd>

   
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-pdo.cubrid-schema-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
    Array containing the schema information, when process is successful; 
  </p>
  <p class="para">
    FALSE, when process is unsuccessful
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-pdo.cubrid-schema-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-1089">
    <p><strong>示例 #1 A <span class="function"><strong>PDO::cubrid_schema()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     This example shows how to get primary key and foreign keys of table game.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$pk_list&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cubrid_schema</span><span style="color: #007700">(</span><span style="color: #0000BB">PDO</span><span style="color: #007700">::</span><span style="color: #0000BB">CUBRID_SCH_PRIMARY_KEY</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"game"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$pk_list</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$fk_list&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cubrid_schema</span><span style="color: #007700">(</span><span style="color: #0000BB">PDO</span><span style="color: #007700">::</span><span style="color: #0000BB">CUBRID_SCH_IMPORTED_KEYS</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"game"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$fk_list</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Result:
Array
(
    [0] =&gt; Array
        (
            [CLASS_NAME] =&gt; game
            [ATTR_NAME] =&gt; athlete_code
            [KEY_SEQ] =&gt; 3
            [KEY_NAME] =&gt; pk_game_host_year_event_code_athlete_code
        )

    [1] =&gt; Array
        (
            [CLASS_NAME] =&gt; game
            [ATTR_NAME] =&gt; event_code
            [KEY_SEQ] =&gt; 2
            [KEY_NAME] =&gt; pk_game_host_year_event_code_athlete_code
        )

    [2] =&gt; Array
        (
            [CLASS_NAME] =&gt; game
            [ATTR_NAME] =&gt; host_year
            [KEY_SEQ] =&gt; 1
            [KEY_NAME] =&gt; pk_game_host_year_event_code_athlete_code
        )

)
Array
(
    [0] =&gt; Array
        (
            [PKTABLE_NAME] =&gt; athlete
            [PKCOLUMN_NAME] =&gt; code
            [FKTABLE_NAME] =&gt; game
            [FKCOLUMN_NAME] =&gt; athlete_code
            [KEY_SEQ] =&gt; 1
            [UPDATE_RULE] =&gt; 1
            [DELETE_RULE] =&gt; 1
            [FK_NAME] =&gt; fk_game_athlete_code
            [PK_NAME] =&gt; pk_athlete_code
        )

    [1] =&gt; Array
        (
            [PKTABLE_NAME] =&gt; event
            [PKCOLUMN_NAME] =&gt; code
            [FKTABLE_NAME] =&gt; game
            [FKCOLUMN_NAME] =&gt; event_code
            [KEY_SEQ] =&gt; 1
            [UPDATE_RULE] =&gt; 1
            [DELETE_RULE] =&gt; 1
            [FK_NAME] =&gt; fk_game_event_code
            [PK_NAME] =&gt; pk_event_code
        )

)
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div></div></div></body></html>